//
// AWS Manager - A free AWS console application demonstrating advanced concepts
// Copyright (C) 2008-2010 Sean O'Dell. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.awsmanager.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Sean ODell
 */
public class EC2IpPermission {

    private String securityGroupRegion;
    private String securityGroupName;
    private String protocol;
    private int fromPort;
    private int toPort;
    private String cidrIps;
    private List<String[]> uid_group_pairs = new ArrayList<String[]>();

    public EC2IpPermission() {
    }

    public String getSecurityGroupRegion() {
        return securityGroupRegion;
    }

    public void setSecurityGroupRegion(String securityGroupRegion) {
        this.securityGroupRegion = securityGroupRegion;
    }

    public String getsecurityGroupName() {
        return securityGroupName;
    }

    public void setsecurityGroupName(String securityGroupName) {
        this.securityGroupName = securityGroupName;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public int getFromPort() {
        return fromPort;
    }

    public void setFromPort(int fromPort) {
        this.fromPort = fromPort;
    }

    public int getToPort() {
        return toPort;
    }

    public void setToPort(int toPort) {
        this.toPort = toPort;
    }

    public void setcidrIp(String cidrIp) {
        this.cidrIps = cidrIp;
    }

    public String getcidrIp() {
        return cidrIps;
    }

    public void addUserGroupPair(String userId, String groupName) {
        this.uid_group_pairs.add(new String[]{userId, groupName});
    }

    public List<String[]> getUidGroupPairs() {
        return uid_group_pairs;
    }

    public EC2IpPermission copy() {
        EC2IpPermission ec2IpPermissionCopy = new EC2IpPermission();
        ec2IpPermissionCopy.setSecurityGroupRegion(this.getSecurityGroupRegion());
        ec2IpPermissionCopy.setsecurityGroupName(this.getsecurityGroupName());
        ec2IpPermissionCopy.setProtocol(this.getProtocol());
        ec2IpPermissionCopy.setFromPort(this.getFromPort());
        ec2IpPermissionCopy.setToPort(this.getToPort());
        return ec2IpPermissionCopy;
    }
}
